package xyz.xuanlee.springcloud.service.impl;

import org.springframework.stereotype.Service;
import xyz.xuanlee.springcloud.service.PaymentService;

@Service
public class PaymentServiceImpl implements PaymentService {

    @Override
    public String paymentInfoOK(Integer id) {
        return String.format("当前线程：%s，支付流水号：%d，最终结果：成功，等待时间：1s",
                Thread.currentThread().getName(),
                id);
    }

    @Override
    public String paymentTimeout(Integer id) {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return String.format("当前线程：%s，支付流水号：%d，最终结果：成功，等待时间：3s",
                Thread.currentThread().getName(),
                id);
    }
}
